<%@ Page Language="C#" ContentType="image/jpeg" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%
Response.Clear();
int height = 200;
int width = 300;
Random	r = new Random();
int	x = r.Next( 100 );
int	x1 = 0;
int	a = r.Next( 255 );
int	x2 = r.Next( 200 );

String s = Request.QueryString[ "i" ];
if( s != null )
	x1 = Convert.ToInt16(s);
while( x1 > (width-75) )
	x1 -= (width-75);
Bitmap bmp = new Bitmap( width, height, PixelFormat.Format24bppRgb );
Graphics g = Graphics.FromImage( bmp );
g.SmoothingMode = SmoothingMode.AntiAlias;
g.Clear( Color.LightGray );
g.DrawRectangle( Pens.White, 1, 1, width-3, height-3 );
g.DrawRectangle( Pens.Gray,  2, 2, width-3, height-3 );
g.DrawRectangle( Pens.Black, 0, 0, width,   height );
g.DrawString( "Hello. This is a test", new Font( "Arial", 10, FontStyle.Bold ), SystemBrushes.WindowText, new Point( 10,50 ) );
g.DrawIcon( SystemIcons.Question, 10, 10 );
g.FillRectangle( new SolidBrush( Color.FromArgb( a, 255,255,255 ) ), x,20, 100,50 );
g.FillRectangle( new SolidBrush( Color.FromArgb( 128, 255,0,0 ) ),   x1,30, 75,30 );
g.FillRectangle( new LinearGradientBrush( new Point(x2,0), new Point(x2+75,50+30), Color.FromArgb( 128, 0,0,128 ), Color.FromArgb( 255, 255,255,240 ) ),   x2 ,50, 75,30 );

bmp.Save( Response.OutputStream, ImageFormat.Jpeg );
g.Dispose(); 
bmp.Dispose(); 
Response.End();
%>

